var express = require('express');
var router = express.Router();
var $dao = require('../dao/userDao');

/* GET users listing. */
router.get('/', function (req, res, next) {
    res.json({code: 200, message: 'ok'});
});

router.post('/add', function (req, res) {
    var body = req.body;
    if (!(/^[1-9]\d*|0$/).test(body.age)) {
        res.json({
            code: 2010,
            msg: "请输入正确的年龄值"
        });
        return;
    }
    $dao.add(req, res);
});
router.get('/:id', function (req, res) {
    $dao.get(req, res);
});
router.post('', function (req, res) {
});
router.put('/:id', function (req, res) {
});
router.delete('/:id', function (req, res) {
});
module.exports = router;
